package com.hz.util;


import java.text.*;
import java.util.Date;

public class DateControl {
	//获取当前日期
	public static String Date(){
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); 
		Date currentTime = new Date();
		String str_date1 = formatter.format(currentTime); 
		String str_date2 = str_date1.toString();
		return str_date2;
	}
	/*
	 * 判断某时间是否在范围内
	 * 参数（String,string,string）
	 * 返回值boolean
	 */
	
	public static boolean isIntime(String currenttime,String starttime,String endtime) throws ParseException {
		SimpleDateFormat smdf = new SimpleDateFormat("yyyy-MM-dd");
		Date currentDate = smdf.parse(currenttime);
		Date startDate = smdf.parse(starttime);
		Date endDate = smdf.parse(endtime);
		if(startDate.before(currentDate)&&endDate.after(currentDate))
		    return true; 
		else 
		    return false;
	    }
	
	public static void main(String args[]) {
		System.out.println(Date());
	}
}
